home *** CD-ROM | disk | FTP | other *** search
- /*
- File: 2020toConnectorGateway.h
-
- Copyright: © 1991-1994 by Apple Computer, Inc.
- All rights reserved.
-
- Part of the AOCE Sample SMSAM Package. Consult the license
- which came with this software for your specific legal rights.
-
- */
-
-
-
- #ifndef __2020TOCONNECTORGATEWAY__
- #define __2020TOCONNECTORGATEWAY__
-
- #ifndef __BLJSTANDARDINCLUDES__
- #include "BLJStandardIncludes.h"
- #endif
-
- #ifndef __TUPLEDATABASE__
- #include "TupleDatabase.h"
- #endif
-
- #ifndef __MAILGATEWAY__
- #include "MailGateway.h"
- #endif
-
- #ifndef __PASCALSTRING__
- #include "PascalString.h"
- #endif
-
- /***********************************|****************************************/
-
- class T2020HalfGateway;
- class TConnectorHalfGateway;
-
- /***********************************|****************************************/
-
- class T2020toConnectorGateway : public TMailGateway
- {
- public:
- T2020toConnectorGateway( short vRefNum, long dirID );
- virtual ~T2020toConnectorGateway();
-
- // This sets the gateway up and gets it ready to start running.
- virtual Boolean Setup ( short vRefNum, long dirID, const char* gatewayName ); // this will load the named configuration
-
- // This 'starts' the gateway off and running.
- virtual Boolean Run(void);
-
- // This prepares the gateway to shut down. The gateway won't be fully shut down until the
- // ReadyToShutDown() returns true.
- virtual Boolean PrepareToShutDown(long inHowManySeconds);
- virtual Boolean ReadyToShutDown(void);
- virtual Boolean CancelGatewayShutdown (void);
- virtual Boolean ShutDown(void);
-
- // These deal with sending a letter from the local system to the remote system.
- virtual Boolean ReceiveLetter (TLetter *letter, THalfGateway *originatorGateway);
- virtual Boolean RereceiveLetter(TLetter* letter, THalfGateway* originatorHalfGateway);
-
- //
- // CONFIGURATION / SETUP METHODS
- // =============================
- //
- virtual Boolean GetConfigItem(const ATupleKey& key, ADataItem& );
- virtual Boolean SetConfigItem(const ATupleKey& key, const ADataItem& );
- virtual Boolean DeleteConfigItem(const ATupleKey& key);
- virtual Boolean GetNthConfigKey(unsigned long index, ATupleKey& key);
-
- //
- // STATUS REPORTING / ERROR REPORTING OPTIONS
- // ==========================================
- //
- virtual Boolean GetStatusItem(const ATupleKey& key, ADataItem& );
- virtual Boolean SetStatusItem(const ATupleKey& key, const ADataItem& );
-
- virtual Boolean GetStatusStr ( CStr255 statusStr ) const;
- virtual Boolean SetStatusStr ( CStr255 statusStr );
-
- virtual Boolean HandleMonitoringEvent ( const ADataItem& event );
-
- protected:
- virtual void PeriodicTasks();
- virtual void DoShutDownThread ( unsigned long inHowManySeconds );
-
- friend void ShutDownThreadWrapper ( unsigned long g, unsigned long h );
-
- ATupleDatabase *fConfigurationDB;
- ATupleDatabase *fStatusDB;
-
- T2020HalfGateway* f2020HalfGateway;
- TConnectorHalfGateway* fConnectorHalfGateway;
-
- TThread * fPeriodicTasks;
- TThread * fShuttingDownThread;
-
- unsigned long fGatewayLetterCount;
- unsigned long fGatewayStartTime;
-
- Boolean fShuttingDown;
- unsigned long fTimeToShutdownAt;
- CStr255 fStatusStr;
- };
-
- /***********************************|****************************************/
- /***********************************|****************************************/
-
- #pragma segment T2020toConnectorGateway
-
- inline Boolean
- T2020toConnectorGateway::GetConfigItem(const ATupleKey& key, ADataItem& data )
- {
- return fConfigurationDB->GetTupleData ( key, data );
- }
-
- /***********************************|****************************************/
-
- inline Boolean
- T2020toConnectorGateway::SetConfigItem(const ATupleKey& key, const ADataItem& data )
- {
- return fConfigurationDB->SetTuple ( key, data );
- }
-
- /***********************************|****************************************/
-
- inline Boolean
- T2020toConnectorGateway::DeleteConfigItem(const ATupleKey& key)
- {
- return fConfigurationDB->DeleteTuple( key );
- }
-
- /***********************************|****************************************/
-
- inline Boolean
- T2020toConnectorGateway::GetNthConfigKey(unsigned long index, ATupleKey& key)
- {
- return fConfigurationDB->GetTupleKey ( index, key );
- }
-
- /***********************************|****************************************/
-
- #endif
-